package com.monas.client.command;

import org.eclipse.core.commands.AbstractHandler;
import org.eclipse.core.commands.ExecutionEvent;
import org.eclipse.core.commands.ExecutionException;
import org.eclipse.ui.IWorkbenchPage;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.handlers.HandlerUtil;

import com.monas.client.view.AbstractMonitorView;

public class SaveChartCommand extends AbstractHandler {

	@Override
	public Object execute(ExecutionEvent event) throws ExecutionException {
		// ambil view yang aktif.
		IWorkbenchPage activePage = PlatformUI.getWorkbench()
				.getActiveWorkbenchWindow().getActivePage();
		String viewId = HandlerUtil.getActivePartId(event);
		AbstractMonitorView view = (AbstractMonitorView) activePage
				.findView(viewId);

		view.saveChart();
		return null;
	}

}
